#include "../include/Course.h"

// 构造函数实现
Course::Course(const std::string& id, const std::string& name, 
               int credit, const std::string& teacher)
    : id(id), name(name), credit(credit), teacher(teacher) {}

// Getter方法实现
std::string Course::getId() const { return id; }
std::string Course::getName() const { return name; }
int Course::getCredit() const { return credit; }
std::string Course::getTeacher() const { return teacher; }

// Setter方法实现
void Course::setId(const std::string& id) { this->id = id; }
void Course::setName(const std::string& name) { this->name = name; }
void Course::setCredit(int credit) { this->credit = credit; }
void Course::setTeacher(const std::string& teacher) { this->teacher = teacher; }

// 输出运算符重载实现
std::ostream& operator<<(std::ostream& os, const Course& course) {
    os << course.id << '\t' << course.name << '\t' 
       << course.credit << '\t' << course.teacher;
    return os;
}

// 输入运算符重载实现
std::istream& operator>>(std::istream& is, Course& course) {
    is >> course.id >> course.name >> course.credit >> course.teacher;
    return is;
}